﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Program07
{
    class CashReturn:CashSuper
    {
        //满减的条件
        private decimal _maneyCondition = 0M;
        //满减返现的金额
        private decimal _maneyReturn = 0M;
        public CashReturn(decimal maneyCondition,decimal maneyReturn)
        {
            this._maneyCondition = maneyCondition;
            this._maneyReturn = maneyReturn;
        }
        public override decimal AcceptCash(decimal money)
        {
            var totalPrice = money;
            if (money >= _maneyCondition)
            {
                totalPrice = money - Math.Floor(money / _maneyCondition) * _maneyReturn;
            }
            return totalPrice;
        }
    }
}
